package com.hongyuan.sellfitness.ui.person.view_mode;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.hongyuan.mvvmhabitx.binding.command.BindingAction;
import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.sellfitness.base.ItemViewModel;
import com.hongyuan.sellfitness.ui.home.beans.PriviteLessonBean;
import com.hongyuan.sellfitness.ui.person.activity.ReservationLessonActivity;
import com.hongyuan.sellfitness.ui.person.activity.UserInfoActivity;

public class MyLessionItemViewModel extends ItemViewModel<MyLessionViewModel> {

    public ObservableField<PriviteLessonBean.ListBean> entity = new ObservableField<>();

    public MyLessionItemViewModel(@NonNull MyLessionViewModel viewModel, PriviteLessonBean.ListBean bean) {
        super(viewModel);
        entity.set(bean);
    }

    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            if(entity.get().getOs_n() == 1){
                Bundle bundle = new Bundle();
                bundle.putString("cp_id",String.valueOf(entity.get().getCp_id()));
                bundle.putString("my_course_id",String.valueOf(entity.get().getMy_course_id()));
                viewModel.startActivity(ReservationLessonActivity.class,bundle);
            }
        }
    });

}
